class MAT{ET<$NFE{ET},VT<$VEC{ET,VT}} < $MAT{ET,VT,MAT{ET,VT}} |
---|
**** | This is a purely Sather implementation of the generic dense concrete matrix class, with *COLUMN-MAJOR* (fortran-style) layout. First index changes most rapidly in stepping thru storage. |
$MAT{_,_,_} | AREF{_} |
MATCPX | MATCPXD | NUMERIC_MAT{_,_} | MATD | MAT |
attr nc:INT; |
---|
**** | number of columns built in feature inherited from AREF{*}, asize = nr*nc. |
attr nr:INT; |
---|
**** | number of rows built in feature inherited from AREF{*}, asize = nr*nc. |
aclear .. Included as aclear |
---|
**** | Set each element of self to nil. Built-in. |
aget(ind:INT):T .. Included as aget |
---|
**** | The element of self with index `ind'. Built-in. |
aget(i1,i2:INT):ET |
---|
**** | The element with indices `[i1,i2]'. |
aset(ind:INT, val:T) .. Included as aset |
---|
**** | Set the element of self with index `ind' to `val'. Built-in. |
aset(i1,i2:INT,val:ET) |
---|
col(i:INT):VT |
---|
col(i:INT,v:VT) |
---|
contents(arg:SAME) |
---|
copy:SAME |
---|
**** | make a value copy. |
create(a: ARRAY{ARRAY{ET}}): SAME |
---|
**** | Create a new array with the same dimensions and values as a, which is an array of arrays(rows). Assume that all the rows of "a" have the same number of elements |
create(r,c:INT):SAME |
---|
**** | Create a matrix with r rows and c columns |
create(arg:SAME):SAME |
---|
**** | Creates a new matrix with the same dimensions (but not the same values) as arg |
create_col_matrix(arg:VT):SAME |
---|
create_row_matrix(arg:VT):SAME |
---|
dimension_str:STR |
---|
**** | useful for debugging, prints out "nr = self.nr, nc = self.nc" |
element_one:ET |
---|
**** | These may need be redefined for MATCPX et al. This is a hack. Zero and one should really be features in in ET < $RING_ELT, where $RING_ELT gives additive and multiplicative identity. |
element_zero:ET |
---|
fits(arg:SAME):BOOL |
---|
**** | will the contents of 'arg' fit into self, ignoring tranposition. |
ident:SAME |
---|
**** | Create an identity matrix of the same shape as self |
inplace(s:ET) |
---|
**** | Set all elements to have the value "s" |
inplace_arg_minus_arg(arg1,arg2:SAME) |
---|
inplace_arg_minus_arg_trans(arg1,arg2:SAME) |
---|
inplace_arg_plus_arg(arg1,arg2:SAME) |
---|
inplace_arg_plus_arg_trans(arg1,arg2:SAME) |
---|
inplace_arg_plus_scaled_arg(arg1:SAME,s:ET,arg2:SAME) |
---|
inplace_arg_plus_scaled_arg_trans(arg1:SAME,s:ET,arg2:SAME) |
---|
inplace_arg_times_arg(arg1,arg2:SAME) |
---|
inplace_arg_times_arg_fast(arg1,arg2:SAME) |
---|
**** | self := arg1 * arg2. Basic algorithm: For all i,j, self(i,j) = sum(k) arg1[i,k] * arg2[k,j] t1 = i+j*nr, index through "self". 0 .. asize-1 t2 = i+arg1.nr*k 0 .. arg1.asize-1 t3 = k+j*arg2.nr |
inplace_arg_times_arg_trans(arg1,arg2:SAME) |
---|
**** | self := arg1 * arg2^T. For all i,j, self[i,j] = sum(k) arg1[i,k] * arg2[j,k] |
inplace_arg_trans(arg:SAME) |
---|
**** | self <- arg^T |
inplace_arg_trans_minus_arg_trans(arg1,arg2:SAME) |
---|
inplace_arg_trans_plus_arg_trans(arg1,arg2:SAME) |
---|
inplace_arg_trans_times_arg(arg1,arg2:SAME) |
---|
**** | self := arg1^T * arg2. For all i,j, self[i,j] = sum(k) arg1[k,i] * arg2[k,j] Likely faster than arg * arg, as inner loop is unit stride for both arrays. |
inplace_arg_trans_times_arg_trans(arg1,arg2:SAME) |
---|
**** | self := arg1^T * arg2^T. For all i,j, self[i,j] = sum(k) arg1[k,i] * arg2[j,k] |
inplace_col_plus_scaled_vec(i:INT,s:ET,v:VT) |
---|
inplace_contents(arg:SAME) |
---|
**** | copy the contents of arg into self. |
inplace_contents_from_function(function:ROUT{INT,INT}:ET) |
---|
**** | Set the contents of the matrix from the function "function" |
inplace_elements(s:ET) |
---|
inplace_ident |
---|
**** | Should work for non rectangular matrices too, non square portion will be set to zero. |
inplace_minus_arg(arg:SAME) |
---|
inplace_minus_arg_trans(arg:SAME) |
---|
inplace_plus_arg(arg:SAME) |
---|
inplace_plus_arg_trans(arg:SAME) |
---|
inplace_plus_scaled_arg(s:ET,arg:SAME) |
---|
inplace_plus_scaled_arg_trans(s:ET,arg:SAME) |
---|
inplace_plus_scaled_vec_times_vec(s:ET,v1,v2:VT) |
---|
**** | self := self + s*v1*v2^T (Add scaled outer product of v1 and v2 to self. A BLAS operation)
|
inplace_portion_of_arg(a: SAME) |
---|
**** | Copy into self as much of arg as will fit and return it. Don't alter other elements. |
inplace_row(i: INT,v: VT) |
---|
inplace_row_plus_scaled_vec(i:INT,s:ET,v:VT) |
---|
inplace_scaled_by(s:ET) |
---|
inplace_scaled_col(s:ET,i:INT) |
---|
inplace_scaled_row(s:ET,i:INT) |
---|
inplace_submatrix_to_arg(lr,ur:INT, lc,uc:INT,arg:SAME) |
---|
**** | Set the submatrix of self given by [lr..ur,lc..uc] to be arg. with proposed syntax extension:
___m.submatrix(1,3,2,4)_:=_m2; |
inplace_swapped(arg:SAME) |
---|
**** | Swap the elements of "arg" with self |
inplace_swapped_col(i:INT,v:VT) |
---|
inplace_swapped_row(i:INT,v:VT) |
---|
inplace_times_diagonal(v1:VT) |
---|
**** | Set self to be the product of itself with a diagonal matrix whose diagonal entries are the components of v1 truncated or extended with zeroes to be the correct size. Scale the columns of self with the elements of v1 Self <- Self*v1 (as diagonal of a matrix) |
inplace_trans |
---|
**** | make self = transpose of self. |
inplace_zero |
---|
**** | Set all elements to zero |
is_eq(m: SAME): BOOL |
---|
is_same_shape(arg:SAME):BOOL |
---|
**** | useful in preconditions. Is arg dimensioned the same as self? |
is_same_shape_trans(arg:SAME):BOOL |
---|
**** | does arg^T conform to 'self'? |
minus(arg:SAME):SAME |
---|
minus_arg(arg:SAME):SAME |
---|
minus_arg_trans(arg:SAME):SAME |
---|
plus(arg:SAME):SAME |
---|
plus_arg(arg:SAME):SAME |
---|
plus_arg_trans(arg:SAME):SAME |
---|
plus_scaled_arg(s:ET,arg:SAME):SAME |
---|
plus_scaled_arg_trans(s:ET,arg:SAME):SAME |
---|
reshape(r,c:INT) |
---|
**** | Reshape 'self' to have 'r' rows and 'c' columns but keeping actual data, as laid out in one dimension, in the same place. This only changes the bounds, the data will logically move rows and columns keeping column major layout. Example: [a d]
_____________m1=[b_e] ________________[c_f]. m1.nr = 3, m1.nc = 2. After m1.reshape(2,3): ________________[a_c_e] _____________m1=[b_d_f] ________________ This feature is NOT in the abstract supertype because it is representation dependent. |
row(i:INT):VT |
---|
row(i:INT,v:VT) |
---|
scaled_by(s:ET):SAME |
---|
size1:INT |
---|
size2:INT |
---|
size: INT |
---|
str:STR |
---|
**** | The string form of self represented as a list of rows, eg. "||1.00,2.33|,|4.5,2.8|,|9.7,3.2||". |
submatrix(lr,ur:INT, lc,uc:INT):SAME |
---|
times(arg:SAME):SAME |
---|
times_arg_trans(arg:SAME):SAME |
---|
times_elt(s:ET):SAME |
---|
**** | Return a new matrix that is self * scalar s Self is unchanged |
times_scaled_vec_into_vec(s:ET,arg,dest:VT) |
---|
times_vec(arg:VT):VT |
---|
**** | This is a syntactical sugar expressions (m*v) so it doesn't follow the naming convention. |
times_vec_into_vec(arg,dest:VT) |
---|
trans:SAME |
---|
**** | Create a new matrix that is the transpose of self |
trans_times_arg(arg:SAME):SAME |
---|
trans_times_arg_trans(arg:SAME):SAME |
---|
trans_times_scaled_vec_into_vec(s:ET,arg,dest:VT) |
---|
trans_times_vec(arg:VT):VT |
---|
trans_times_vec_into_vec(arg,dest:VT) |
---|
col_elt!(once col:INT):ET |
---|
**** | Yield elements by varying index 1 and holding index 2 at `col'. The elements of a "column" col |
col_ind!:INT |
---|
**** | Yield each value of the second index in order. The columns |
diag_elt!: ET |
---|
**** | Yield values along the diagonal (square in smaller dimension) |
elt!: ET |
---|
**** | Yield all elements in row major order |
elt1!(once i1:INT):ET |
---|
**** | Yield elements by varying index 2 and holding index 1 at `i1'. The elements of a row "i1" this is the same as row_elt! |
elt2!(once i2:INT):ET |
---|
**** | Yield elements by varying index 1 and holding index 2 at `i2'. The elements of a "column" i2 this is the same as col_elt! |
ind1!: INT |
---|
**** | Yield each value of the first index in order. The rows |
ind2!:INT |
---|
**** | Yield each value of the second index in order. The columns |
inds!:TUP{INT,INT} |
---|
**** | Yield tuples of the indices of self in lexicographical order. |
inplace_col!(once col:INT, val:ET) |
---|
**** | Set to val elements with varying index 1 and index 2 fixed at `col'. i.e. setting the column col |
inplace_diag_elt!(val:ET) |
---|
**** | Set values along the diagonal (square in smaller dimension) |
inplace_elt!(val:ET) |
---|
**** | Set all elements in row major order |
inplace_row!(once row:INT, val:ET) |
---|
**** | Set to val elements with varying index 2 and index 1 fixed at `row'. i.e. setting a row "row" |
row_elt!(once row:INT):ET |
---|
**** | Yield elements by varying index 2 and holding index 1 at `row'. The elements of a row "row" |
row_ind!: INT |
---|
**** | Yield each value of the first index in order. The rows |
set1!(once i1:INT, val:ET) |
---|
**** | Set to val elements with varying index 2 and index 1 fixed at `i1'. i.e. setting the row i1 this is the same as set_row! |
set2!(once i2:INT, val:ET) |
---|
**** | Set to val elements with varying index 1 and index 2 fixed at `i2'. i.e. setting the column i2 this is the same as set_col! |
set_col!(once i2:INT, val:ET) |
---|
**** | Set to val elements with varying index 1 and index 2 fixed at `i2'. i.e. setting the column i2 |
set_row!(once i1:INT, val:ET) |
---|
**** | Set to val elements with varying index 2 and index 1 fixed at `i1'. i.e. setting the row i1 |
acopy(beg,num,srcbeg:INT, src:SAME) .. Included as acopy |
---|
**** | Copy `num' elements from `src' to self starting at index `beg' of self and index `srcbeg' of `src'. Built-in. |
acopy(beg,num:INT, src:SAME) .. Included as acopy |
---|
**** | Copy `num' elements from `src' to self starting at index `beg' of self. |
acopy(beg:INT, src:SAME) .. Included as acopy |
---|
**** | Copy as many elements from `src' to self as will fit when starting at index `beg' of self. |
acopy(src:SAME) .. Included as acopy |
---|
**** | Copy as many elements from `src' to self as will fit. Built-in. |
aelt!(once beg:INT):T .. Included as aelt! |
---|
**** | Yield each element of self starting at `beg'. Built-in. |
aelt!(once beg,once num:INT):T .. Included as aelt! |
---|
**** | Yield `num' successive elements of self starting at index `beg'. Built-in. |
aelt!(once beg,once num,once step:INT):T .. Included as aelt! |
---|
**** | Yield `num' elements of self starting at `beg' and stepping by `step' which must not be zero. Built-in. |
aelt!:T .. Included as aelt! |
---|
**** | Yield each element of self in order. Built-in. |
aind!:INT .. Included as aind! |
---|
**** | Yield the indices of self in order. |
array_ptr:C_PTR .. Included as array_ptr |
---|
aset!(val:T) .. Included as aset! |
---|
**** | Set successive elements of self to the values `val'. Built-in. |
aset!(once beg:INT,val:T) .. Included as aset! |
---|
**** | Set successive elements of self starting at `beg' to the values `val'. |
aset!(once beg,once num:INT,val:T) .. Included as aset! |
---|
**** | Set `num' successive elements of self starting at `beg' to the values `val'. |
aset!(once beg,once num,once step:INT, val:T) .. Included as aset! |
---|
**** | Set `num' elements of self starting at `beg' stepping by `step' to the values `val'. `step' must not be zero. |
asize:INT .. Included as asize |
---|
**** | The number of elements in self. Classes which inherit this may replace this by a constant to get constant sized objects (and the compiler may optimize certain operations in this case). Built-in. |
create(n:INT):SAME .. Included as create |
---|
**** | A new array with `n' elements. |
is_legal_aelts_arg( beg, num, step:INT) :BOOL .. Included as is_legal_aelts_arg |
---|
**** | True if the arguments are legal values for `aelts'. |
attr nc:INT; |
---|
**** | number of columns built in feature inherited from AREF{*}, asize = nr*nc. |
attr nr:INT; |
---|
**** | number of rows built in feature inherited from AREF{*}, asize = nr*nc. |